package com.xyz.study.design_mode.p_mediator;

import com.xyz.study.design_mode.p_mediator.mode.*;

/**
 * 简单化：其二 ---- 仲裁者模式
 * 角色：Client
 * 只有一个仲裁者，组员向仲裁者报告，仲裁者向组员下达指示
 * 示例：小红吃完晚饭和妈妈说很无聊，妈妈让小明和陪小红一起看电影
 * @author XYZ
 * @version 1.0.0
 * @since 2020/6/22
 */
public class MediatorMain {
    public static void main(String[] args) {
        Colleague xiaoHong = new XiaoHong();
        Colleague xiaoMing = new XiaoMing();
        Mediator mother = new Mother(xiaoHong, xiaoMing);
        xiaoHong.setMediator(mother);
        xiaoMing.setMediator(mother);
        xiaoHong.colleagueChanged();
        System.out.println("-------------小明正在陪小红看电影------------");
        xiaoMing.colleagueChanged();
    }
}
